# Maintainer:
# Contributor: Marcus Hoffmann <bubu@bubu1.eu>

_pyname=nh3
pkgname=python-$_pyname
pkgver=0.2.14
pkgrel=1
pkgdesc='Ammonia HTML sanitizer Python binding'
arch=(loong64 x86_64)
url='https://github.com/messense/nh3'
license=(MIT)
depends=(gcc-libs
         glibc
         python)
checkdepends=(python-pytest)
makedepends=(python-build
             python-installer
             python-maturin)
source=(https://github.com/messense/nh3/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('fdce9fa1cbcd6bfa73a0040ad6a40d2a5f753d95a4ff345d49b5044cfd74ca5e')

build() {
  cd $_pyname-$pkgver 
  python -m build --wheel --no-isolation 
}
 
check() {
  cd $_pyname-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest -v
}

package() {
  cd $_pyname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
